<?php
//教学团队
namespace app\admin\controller;

use app\admin\controller\Base;
use app\admin\model\Admin;

use think\Request;

class Teachingteam extends Base
{
    //老师显示页面
    public function teacher()
    {
        $da = input("post.search");
        if (empty($da)) {
            $res = Admin::where(['roles_id'=>2])->select();
            $this->assign('res', $res);
            return $this->fetch();
        } else {
            $res = Admin::where(['roles_id'=>2,'username'=>['like',$da]])->select();
            if ($res) {
                $this->assign('res', $res);
                return $this->fetch();

            } else {
                echo "<script>alert('对不起没有这个人');  window.location.href=document.referrer;</script>";
            }
        }

    }

    //学管(展示页面)
    public function nmgsfdxxgh()
    {
        //3  学管
        $d = input("post.");
        if (empty($d)) {
            $res = Admin::where(['roles_id'=>3])->select();
            $this->assign('res', $res);
            return $this->fetch();
        } else {
            $res = Admin::where(['roles_id'=>3,'username'=>['like',$d]])->select();
            if ($res) {
                $this->assign('res', $res);
                return $this->fetch();
            } else {
                echo "<script>alert('对不起没有这个人');window.location.href=document.referrer;</script>";
            }
        }


    }

    //教务(展示页面)
    public function educationaladministration()
    {  //r_id 1教务
        $d = input("post.");
        // dump($d);
        if (empty($d)) {
            $res = Admin::where(['roles_id'=>1])->select();
            $this->assign('res', $res);
            return $this->fetch();
        } else {

            $res = Admin::where(['roles_id'=>1,'username'=>['like',$d]])->select();
            if ($res) {
                $this->assign('res', $res);
                return $this->fetch();

            } else {
                echo "<script>alert('对不起没有这个人');window.location.href=document.referrer</script>";
            }

        }


    }


}


?>